//gaucho.cpp

#include "gaucho.h"
#include <math.h>
#include <stdio.h>


//Object's default constructor. Initializes all of the object's private variables.
gaucho::gaucho()
{
  loc.x=0;
  loc.y=0;
  damage = 20; //how many health points it will delete from the enemy
  attack_speed =0;
  range = 2;
  cost = 1;
}

//This function checks to see if an enemy object is within range of this object. An object of the enemy class is sent in to the function and a boolean is returned. It returns true if the enemy object is within range, and false otherwise.
bool gaucho::check_range(enemy *x)
{
  if(pow((pow((x->getCoordinates().x)-(this->loc.x),2)+pow(((x->getCoordinates().y)-(this->loc.y)),2)),.5)<range)
    {
      return true;
    }
  else
    return false;
}

//This function returns the x,y pair location of the object. 
pair gaucho::getLoc()
{
  return loc;
}

 //This function manipulates the gaucho's x position
void gaucho::setX(int m)
{
  loc.x =m;
}

 //This function manipulates the gaucho's x position
void gaucho::setY(int m)
{
  loc.y =m;
}

//This function takes an x,y pair and changes the object's x,y location to the x,y pair that was passed in.
void gaucho::setLoc(pair p)
{
  loc.x = p.x;
  loc.y = p.y;
}

//This function returns the amount of damage done by an object.
double gaucho::getDamage()
{
  return damage;
}

//This function takes a double and changes the object's damage variable to the double that was passed in. 
void gaucho::setDamage(double d)
{
  damage = d;
}

//This function returns how often the object can attack.
double gaucho::getAttack_speed()
{
  return attack_speed;
}

//This function takes a double and changes the object's attack_speed variable to the double that was passed in.
void gaucho::setAttack_speed(double d)
{
  attack_speed = d;
}

//This function returns the attack range for an object.
double gaucho::getRange()
{
  return range;
}

//This function takes a double and changes the object's range variable to the double that was passed in. 
void gaucho::setRange(double d)
{
  range = d;
}

//This function returns how much resources an object requires to be contructed.
double gaucho::getCost()
{
  return cost;
}

//This function takes a double and changes the object's cost variable to the double that was passed in. 
void gaucho::setCost(double d)
{
  cost = d;
}

//This is the object's destructor.
gaucho::~gaucho()
{
}
